Skip to main content

Creating and writing into Stream Data Sets

3 Tasks

20 mins

Visible to: All users
Beginner Pega Platform English
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Scenario

In the Sample application, a new Sample-Data-Transactions class is available with the following Data Model:

Field Type Description

TransactionID

Identifier

Unique transaction identifier

CardNumber

Text

The card number associated with the transaction

Amount

Decimal

The amount of the transaction

Currency

Text

The currency of the transaction

MerchantName

Text

The name of the merchant

MerchantCategory

Text

Merchant category

TransactionTime

Date time

The data and time of the transaction

The following artifacts are available for you:

  • A Transaction Service Service Package Rule that determines the security scheme and access for the services in the package.
  • A Card Transactions Service REST Rule that exposes a REST API that the system can call externally.
  • An InsertIntoStream Activity Rule that saves the incoming data to a Stream Data Set.

Create a new Transaction Stream Data Set, and use the provided Service REST Rule to create a new record in the stream.

Use the following credentials to log in to the exercise system:

Role User name Password
System architect SystemArchitect rules

Your assignment consists of the following tasks:

Task 1: Create a new Stream Data Set

Create Transaction Stream Stream Data Set in the Sample-Data-Transactions class. Review the JSON payload for writing to the stream.

Task 2: Write to the Stream Data Set

Using the provided Card Transactions REST service, create a new transaction record in the Transaction Stream Data Set.

Note: For the purposes of the exercise, the following Rules are created by the System Architect
A Service Package Rule, Transaction Service, determines the security scheme and access for the services in the package.
A Service REST Rule, Card Transactions, that exposes a REST API that can be called externally.
An Activity Rule, InsertIntoStream, saves the incoming data to a Stream Data Set.

Task 3: Preview the data in the Stream Data Set

Browse the data available in the Stream Data Set.

 

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Create a new Stream Data Set

  1. Log in as the System Architect:
    1. In the User name field, enter SystemArchitect.
    2. In the Password field, enter rules.
  2. In the navigation pane of Dev Studio, click App to open the Application Explorer.
  3. In the Application Explorer, search for the Sample-Data-Transactions class.
  4. In the Application Explorer, right-click the Sample-Data-Transactions class, and then select Create > Data Model > Data Set.
  5. On the Create Data Set tab, create a new Data Set:
    1. In the Label field, enter Transaction Stream.
    2. In the Type list, select Stream.
    3. In the upper-right corner, click Create and open.
      The creation of the Transaction Stream Data Set
  6. On the Edit Data set: Transaction Stream tab, in the Integration section, expand the Custom service section:
    1. In the REST column, click view example to preview a sample REST payload.
      The expanded Integration section with the sample REST payload
    2. Confirm that a payload example is displayed, and then click Submit.
      Submit
      Note: In this case, the sample payload for the Stream Data Set is populated from the data structure defined in the Sample-Data-Transactions class.
  1. In the upper-right corner, click Save.

2 Write to the Stream Data Set

  1. In the header of Dev Studio, in the search field, enter Transaction Service, then click enter.
  2. In the search results, click the TransactionService Service REST Rule.
    The TransactionService REST Rule
    Note: For the purposes of the exercise, the System Architect preconfigures the Card Transactions Service Rest Rule. The service invokes the InsertIntoStream Activity Rule that inserts the incoming payload to the TransactionStream Data Set.
  1. In the Service REST: Card Transactions Rule, in the upper-right corner, click Actions > Run.
    The Run action on the Service REST Rule form
  2. In the Simulate REST Service Execution window, complete the following settings:
    1. In the HTTP Method section, select POST.
    2. In the Message Buffer section, enter the following payload.
      Note that this payload shares the same structure as the payload generated in the Transactions Stream Data Set.
      {
      "CardNumber" : "1234123412341234",
      "TransactionTime" : "20230929T130349.756 GMT",
      "MerchantName" : "Sample Merchant",
      "MerchantCategory" : "Travel",
      "Currency" : "USD",
      "Amount" : "280",
      "TransactionID" : "TID-1"
      }
    3. Click Execute.
      The Simulate REST Service Execution window
    4. Confirm that the Service Simulation Results returns a Success status, and then close the window.
      The Service Simulation Results for the REST Service

3 Preview the data in the Stream Data Set

  1. In the Application Explorer, search for the Sample-Data-Transactions class.
  2. In the Application Explorer, click Data Model > Data Set, then click TransactionStream.
    TransactionStream
  3. On the Data set: Transaction Stream tab, in the upper-right corner, click Actions > Run.
  4. In the Data Set Preview window, view the data:
    1. In the run context, in the Operation list, select Browse.
    2. In the upper-right corner of the run context, click Run to view the run results.
    3. Review the Result(1).
      The results of the sample Data Set


Available in the following mission:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice